<%@ page errorPage="error.jsp" contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>

<% Class.forName("oracle.jdbc.OracleDriver"); %>

<html>
<head>

</head>
<body>


 <% 
	
	

            Connection connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:xe", "SEPROJECT", "123456");

            Statement statement = connection.createStatement() ;

        String name = request.getParameter("admin_name");
        String pwd = request.getParameter("pwd");
        

	 String queryText = "select USR_NAME, PWD FROM ADMINS";

	ResultSet rst = statement.executeQuery(queryText);

	while(rst.next()){ 
	
	String dbname = rst.getString("USR_NAME");	
	String dbpwd = rst.getString("PWD");

	

	if(name.equals(dbname) && pwd.equals(dbpwd))
	{

	String site = new String("/520project/home4.jsp");
   response.setStatus(response.SC_MOVED_TEMPORARILY);
   response.setHeader("Location", site); 

	}

	}
            


  %>

<p>Login failed</p>
<a href="login.jsp" style="text-decoration:blink;"><b>Go back</b></a>

</body>
</html>